package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;


/**
 * Test for Recipe class.
 */


public class RecipeTest extends TestCase {
	
	private Recipe r3;
	
	
	/**
	 * Method to setup fixtures for tests.
	 */
	public void setUp() {
		r3 = new Recipe();
		r3.setName("r3");
		r3.setPrice(-1);
		r3.setAmtChocolate(-1);
		r3.setAmtMilk(-1);
		r3.setAmtSugar(-1);
		r3.setAmtCoffee(-1);
	}
	
	/**
	 * Test for to check negative values return zero for set ingredients method.
	 */
	public void testRecipieNegativeIngrediantsReturnZero(){
		assertEquals(0, r3.getAmtChocolate());
		assertEquals(0, r3.getAmtCoffee());
		assertEquals(0, r3.getAmtMilk());
		assertEquals(0, r3.getAmtSugar());
	}
	
	
	/**
	 * Test for price set to negative number returns zero on setPrice method.
	 */
	public void testRecipieNegativePriceReturnsZero(){
		assertEquals(0,r3.getPrice());
	}
	
	
	/**
	 * Test for equals method.
	 */
	public void testEquals() {
		Recipe r4 = new Recipe();
		r4.setAmtChocolate(1);
		r4.setAmtCoffee(1);
		r4.setAmtMilk(1);
		r4.setAmtSugar(1);
		r4.setPrice(1);
		r4.setName(null);
		assertFalse(r4.equals(r3));
		r3.setName("r3");
		assertFalse(r4.equals(r3));
	}
	
	
	/**
	 * Test for toString method.
	 */
	public void testToString() {
		r3.setName("r3");
		assertEquals("r3", r3.toString());
	}
	
	
	/**
	 * Test for setAmtChocoate method.
	 */
	public void testSetChocolate() {
		r3.setAmtChocolate(2);
		assertEquals(2,r3.getAmtChocolate());
	}
	
	
	/**
	 * Test for setAmtCoffee method.
	 */
	public void testSetCoffee() {
		r3.setAmtCoffee(2);
		assertEquals(2,r3.getAmtCoffee());
	}
	
	/**
	 * Test for setAmtMilk method.
	 */
	public void testSetMilk() {
		r3.setAmtMilk(2);
		assertEquals(2,r3.getAmtMilk());
	}
	
	/**
	 * Test for setAmtSugar method.
	 */
	public void testSetSugar() {
		r3.setAmtSugar(2);
		assertEquals(2,r3.getAmtSugar());
	}
	
	/**
	 * Test for setPrice method.
	 */
	public void testSetPrice() {
		r3.setPrice(2);
		assertEquals(2,r3.getPrice());
	}
	
	/**
	 * Test for getName method. 
	 */
	public void testGetName() {
		assertEquals("r3", r3.getName());
		assertTrue(r3.equals(r3));
		r3.setName(null);
		assertFalse(r3.equals(r3));
	}

}
